<?php 

class ShopCategory
{
	function getShopCatsMenuHTML($cats)
	{
		if($cats)
		{
			$output .= '<ul>';
			foreach($cats as $cat)
			{

				$style = ' style="background-image:url('.SYSICONS_URL.'treemenu/folder_tar_16.gif)" ';
				$output .= '<li id="cat_'.$cat['id'].'" class="'.$li_class.' leaf" '.$state.' rel="product_cat">';
				$output .= '<a '.$style.' href="?con='.$_REQUEST['con'].'&amp;cat='.$cat['id'].'">';
				$output .= $cat['title'];
				$output .= '</a>';
				$output .= '</li>';
			}
			$output .= '</ul>';
		}
		return $output;
	}
	
	function getShopCats()
	{
		$i=0;
		$result = mysql_query('SELECT * FROM '.DB_PERFIX.'product_cats;');
		if(mysql_num_rows($result) > 0)
		{
			while($row = mysql_fetch_array($result))
			{
				$item[$i]['id'] = $row['id'];
				$item[$i]['title'] = $row['title'];
				$item[$i]['title_import'] = $row['title_import'];
				$item[$i]['active'] = $row['active'];
				$i++;
			}
			return $item;
		}
	}
	
	function getShopCat($id)
	{
		if($id > 0)
		{
			$result = mysql_query('SELECT * FROM '.DB_PERFIX.'product_cats WHERE id='.$id.';');
			if(mysql_num_rows($result) > 0)
			{
				while($row = mysql_fetch_array($result))
				{
					$item[$i]['id'] = $row['id'];
					$item[$i]['title'] = $row['title'];
					$item[$i]['title_import'] = $row['title_import'];
					$item[$i]['active'] = $row['active'];
					$i++;
				}
				return $item;
			}
		}
	}
}

?>